%h1.page_title Upload a photo
= error_messages_for :photo
  - form_for :photo, @photo, :url => photos_url, :html => {:multipart => true} do |f|
  %table.new_photo
    %tr
      %td.field_title Photo:
      %td.field= file_field_tag 'photos[]'
      %td.field= file_field_tag 'photos[]'
      %td.error= error_messages_for :photo
    %tr
      %td.field_title
      %td.field= file_field_tag 'photos[]'
      %td.field= file_field_tag 'photos[]'
    %tr
      %td.field_title
      %td.field= file_field_tag 'photos[]'
      %td.field= file_field_tag 'photos[]'
    %tr
      %td.field_title
      %td.field= file_field_tag 'photos[]'
      %td.field= file_field_tag 'photos[]'
    %tr
      %td.field_title
      %td.field= file_field_tag 'photos[]'
      %td.field= file_field_tag 'photos[]'
    %tr
      %td.field_title Galleries:
      %td.field
        - if @galleries.empty?
          No galleries have been created yet.
          %a{:href => new_gallery_url, :title => "Create a new Gallery"}Create one
        - else
          %select{:id => "photo[gallery_ids][]", :name => "photo[gallery_ids][]", :multiple => true, :size => 8, :width => 10}
            - @galleries.each do |gallery|
              %option{:value => gallery.id, :selected => ("selected" if @photo.galleries.include?(gallery))}= gallery.name
      %td.error= error_message_on :photo, :gallery_ids
    %tr
      %td.field_title Options:
      %td.field
        %table.photo_options
          %tr
            %td.photo_options_field= check_box_tag("photo[random]", 1)
            %td.photo_options_field_title One of the images that cycles on the homepage
            %td.error= error_message_on :photo, :random
          %tr
            %td.photo_options_field= check_box_tag("photo[is_thumbnail]", 1)
            %td.photo_options_field_title Part of the thumbnails image group
            %td.error= error_message_on :photo, :is_thumbnail
          %tr
            %td.photo_options_field= check_box_tag("photo[is_purchasable]", 1)
            %td.photo_options_field_title Make this photo available for purchase
            %td.error= error_message_on :photo, :is_purchasable
          %tr
            %td.photo_options_field=check_box_tag("photo[is_private]", 1)
            %td.photo_options_field_title Mark this photo as private
            %td.error= error_message_on :photo, :is_private
    %tr
      %td
      %td.submit= submit_tag 'upload'